class CPU {
  startup() { console.log('打开CPU') }
  shutdown() { console.log('关闭CPU') }
}
class Memory {
  startup() { console.log('打开内存') }
  shutdown() { console.log('关闭内存') }
}
class Disk {
  startup() { console.log('打开硬盘') }
  shutdown() { console.log('关闭硬盘') }
}
class Computer {
  cpu;
  memory;
  disk;
  constructor() {
    this.cpu = new CPU()
    this.memory = new Memory()
    this.disk = new Disk()
  }
  startup() {
    this.cpu.startup()
    this.memory.startup()
    this.disk.startup()
  }
  shutdown() {
    this.cpu.shutdown()
    this.memory.shutdown()
    this.disk.shutdown()
  }
}
const computer = new Computer()
computer.startup()
computer.shutdown()
